<html>
<head>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

window.onmessage = function(evt)
{
    if (evt.data != "done") {
        alert("Unexpected message: " + evt.data);
        testRunner.notifyDone();
        return;
    }
    try {
        alert("Child window's history object after attempt to clear: " + window.frames[0].history);
    } catch (e) {
        alert("PASS: Access to window.frames[0].history threw an exception.");
    }
    testRunner.notifyDone();
}

function setHistoryLength()
{
    try {
        alert("Child window's history object before attempt to clear: " + window.frames[0].history);
    } catch (e) {
        alert("PASS: Access to window.frames[0].history threw an exception.");
    }
    window.frames[0].postMessage("setHistoryLength", "*");
}

</script>
</head>
<body onload="setHistoryLength();">
<iframe id='testFrame' src="http://localhost:8000/history/resources/cross-origin-replaces-history-object-child-iframe.html"></iframe>
</body>
</html>
